﻿using DayuCode.Designer.Entity;
using DayuCode.Designer.Entity.UI;
using DayuCode.Designer.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DayuCode.Designer.Service.ui
{
	public class PageConfigHandler
	{
		private static string getBaseUrl(string methodName)
		{
			return AppInstance.ApiServer + "api/base/dayucode_pageConfigHandler/" + methodName;
		}

		public static List<HFormField> transTableColumnToFormField(IList<long> tableColumnIds)
		{
			List<HFormField> obj = QHttpClient.Post<List<HFormField>>(getBaseUrl("transTableColumnToFormField"), new { tableColumnIds = tableColumnIds });
			return obj;
		}

		public static List<HDataGridColumn> transTableColumnToGridColumn(IList<long> tableColumnIds)
		{
			List<HDataGridColumn> obj = QHttpClient.Post<List<HDataGridColumn>>(getBaseUrl("transTableColumnToGridColumn"), new { tableColumnIds = tableColumnIds });
			return obj;
		}

		public static PageConfigVO getPageConfigVO(long tableId, string terminalType)
		{
			PageConfigVO obj = QHttpClient.Post<PageConfigVO>(getBaseUrl("getPageConfigVO"), new { tableId = tableId, terminalType = terminalType });
			return obj;
		}

		public static PageConfigVO savePageConfigVO(PageConfigVO pageConfigVO)
		{
			PageConfigVO obj = QHttpClient.Post<PageConfigVO>(getBaseUrl("savePageConfigVO"), new { pageConfigVO = pageConfigVO });
			return obj;
		}


		public static List<CodeItem> getCodeTypes(long pagelayoutId)
		{
			List<CodeItem> obj = QHttpClient.Post<List<CodeItem>>(getBaseUrl("getCodeTypes"), new { pagelayoutId = pagelayoutId });
			return obj;
		}
	}
}
